"#include \"AtmosphereShadersCommon.fxh\"\n"
"\n"
"Texture2D<float2> g_tex2DMinMaxLightSpaceDepth;\n"
"\n"
"cbuffer cbMiscDynamicParams\n"
"{\n"
"    MiscDynamicParams g_MiscParams;\n"
"}\n"
"\n"
"// 1D min max mip map is arranged as follows:\n"
"//\n"
"//    g_MiscParams.ui4SrcDstMinMaxLevelOffset.x\n"
"//     |\n"
"//     |      g_MiscParams.ui4SrcDstMinMaxLevelOffset.z\n"
"//     |_______|____ __\n"
"//     |       |    |  |\n"
"//     |       |    |  |\n"
"//     |       |    |  |\n"
"//     |       |    |  |\n"
"//     |_______|____|__|\n"
"//     |<----->|<-->|\n"
"//         |     |\n"
"//         |    uiMinMaxShadowMapResolution/\n"
"//      uiMinMaxShadowMapResolution/2\n"
"//                         \n"
"void ComputeMinMaxShadowMapLevelPS(in FullScreenTriangleVSOutput VSOut,\n"
"                                   out float2 f2MinMaxDepth : SV_Target)\n"
"{\n"
"    uint2 uiDstSampleInd = uint2(VSOut.f4PixelPos.xy);\n"
"    uint2 uiSrcSample0Ind = uint2(g_MiscParams.ui4SrcDstMinMaxLevelOffset.x + (uiDstSampleInd.x - g_MiscParams.ui4SrcDstMinMaxLevelOffset.z)*2u, uiDstSampleInd.y);\n"
"    uint2 uiSrcSample1Ind = uiSrcSample0Ind + uint2(1,0);\n"
"    float2 f2MinMaxDepth0 = g_tex2DMinMaxLightSpaceDepth.Load( int3(uiSrcSample0Ind,0) ).xy;\n"
"    float2 f2MinMaxDepth1 = g_tex2DMinMaxLightSpaceDepth.Load( int3(uiSrcSample1Ind,0) ).xy;\n"
"\n"
"    f2MinMaxDepth.x = min(f2MinMaxDepth0.x, f2MinMaxDepth1.x);\n"
"    f2MinMaxDepth.y = max(f2MinMaxDepth0.y, f2MinMaxDepth1.y);\n"
"}\n"
